﻿<%@ Page Language="C#"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> 
    <link href="../../Styles/jquery.validate.css" rel="stylesheet" type="text/css" /> 
    <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script> 
     <script src="../../Scripts/jquery.validator.messages.js" type="text/javascript"></script>     
    <script type="text/javascript" src="../../Scripts/jquery.query.js"></script>
    <script src="../js/blockUI.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server"   method="post" action="../AjaxHandler/SysConfigEditHandler.ashx?action=Edit">
    <div>
        <table>
           
            <tr>
                <td>
                    SMTP服务：
                </td>
                <td>
                    <input type="text" id="smtp" name="smtp" />
                </td>
            </tr>
            <tr>
                <td>
                    POP3服务：
                </td>
                <td>
                    <input type="text" id="pop3" name="pop3" />
                </td>
            </tr>
            <tr>
                <td>
                   邮箱
                </td>
                <td>
                     <input type="text" id="email" name="email" />
                </td>
            </tr>
            <tr>
                <td>
                   密码
                </td>
                <td>
                     <input type="password" id="emailpwd" name="emailpwd" />
                </td>
            </tr>
            
            <tr>
                <td>
                   邮箱类型
                </td>
                <td>
                    <select id="emailtype" name="emailtype">
                    <option>留言邮箱</option>
                    <option>门票邮箱</option>
                    <option>客服邮箱</option>
                    <option>系统邮箱</option>
                    <option>其他</option>
                    </select>
                </td>
            </tr>
           <tr>
                <td>
                    备注
                </td>
                <td>
                    <textarea id="remark" rows="5" cols="20" name="remark" ></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" id="btn_Save" value="保 存" /><input type="button" id="btn_Back" value="返 回"  onclick="javascript:history.back();" />
                </td>
            </tr>
        </table>
    </div>
    <input id="hidCode" name="hidCode" type="hidden" value="-1" />
    </form>
     <script type="text/javascript">
         $(document).ready(function () {
             var code = $.query.get("code");
             $("#hidCode").val(code);

             var BindData = function () {

                 if (code != "-1") { 
                  $.blockUI({ message: "<h2>数据加载中.......</h2>", css: { width: "300px", height: "50px"} });
                     $.post("../AjaxHandler/SysConfigEditHandler.ashx", { action: "Get", hidCode: code }, function (data) {
                         $("#smtp").val(data.SMTP);
                         $("#pop3").val(data.POP3);
                         $("#email").val(data.Email);
                         $("#emailtype").val(data.EmailType);
                         $("#emailpwd").val(data.EmailPwd);
                         $("#remark").val(data.Remark); 
                         $.unblockUI();
                     });
                 }
                
             }
             BindData();

             $("#form1").validate({
                 rules: {
                     smtp: {
                         required: true
                     },

                     email: {
                         required: true,
                         email: true
                     },
                     emailpwd: {
                         required: true
                     }
                 },
                 messages:
                    {
                        smtp: { required: "请输入邮箱服务器" },
                        email: { required: "请输入邮箱", email: "邮箱格式不正确" },
                        emailpwd: { required: "请输入邮箱密码" }
                    }
             });

         });
    </script>
</body>
</html>
